#!/usr/bin/env/python
import feedparser
import urllib

from clutter import Text
from box import LBox

class RSSDisplayer(LBox):
    def __init__(self):
        LBox.__init__(self, orientation="vertical")
        xml = urllib.urlopen("https://mail.google.com/mail/feed/atom")
        data = xml.read()

        f = feedparser.parse(data)
        print len(f["entries"])
        for item in f.entries:
            self.add_item(item["title"])

    def add_item(self, string):
        t = Text()
        t.set_text(string)
        t.show()
        self.add(t)
